Fix internal error on TypeForm attribute access (fixes #4747) - #4818
Open
shobhitmehro wants to merge 1 commit into
Open
Fix internal error on TypeForm attribute access (fixes #4747)#4818shobhitmehro wants to merge 1 commit into
shobhitmehro wants to merge 1 commit into
Conversation
shobhitmehro
force-pushed
the
fix/4747-typeform-attr-internal-error
branch
from
September 5, 2026 01:28
26f9eaf to
db5deb6
Compare
|
Diff from mypy_primer, showing the effect of this PR on open source code: ============================================================
SUMMARY
============================================================
Total: +6 new errors, -17 fixed errors
By preset: +5/-17 (default), +5/-17 (strict)
Projects with changes (1):
beartype: +6 -17
============================================================
FULL DIFF DETAILS
------------------------------------------------------------
beartype (https://github.com/beartype/beartype)
- ERROR beartype/_check/cls/hint/hintsane.py:516:17-40: TODO: Expr::binop_infer attribute base undefined for type: TypeForm[Any] (trying to access __eq__) [internal-error]
- ERROR beartype/_check/convert/_reduce/_pep/pep484/redpep484ref.py:267:8-25: TODO: __bool__ attribute base undefined for type: TypeForm[Any] (trying to access __bool__) [internal-error]
- ERROR beartype/_check/convert/_reduce/redmain.py:368:16-54: TODO: Expr::binop_infer attribute base undefined for type: TypeForm[Any] (trying to access __eq__) [internal-error]
+ ERROR beartype/_util/hint/pep/proposal/pep484/pep484604union.py:150:31-32: Unused `# type: ignore` comment [unused-type-ignore]
- ERROR beartype/_util/hint/pep/proposal/pep484/pep484newtype.py:84:16-34: TODO: Expr::attr_infer_for_type attribute base undefined for type: TypeForm[Any] (trying to access __supertype__) [internal-error]
+ ERROR beartype/_util/hint/pep/proposal/pep484/pep484newtype.py:84:16-34: Object of class `object` has no attribute `__supertype__` [missing-attribute]
- ERROR beartype/_util/hint/pep/proposal/pep484/pep484typevar.py:275:8-24: TODO: __bool__ attribute base undefined for type: TypeForm[Any] (trying to access __bool__) [internal-error]
- ERROR beartype/_util/hint/pep/proposal/pep484585/generic/pep484585genfind.py:522:8-24: TODO: __bool__ attribute base undefined for type: TypeForm[Any] (trying to access __bool__) [internal-error]
- ERROR beartype/_util/hint/pep/proposal/pep484585/generic/pep484585genfind.py:957:12-28: TODO: __bool__ attribute base undefined for type: TypeForm[Any] (trying to access __bool__) [internal-error]
- ERROR beartype/_util/hint/pep/proposal/pep484585/generic/pep484585genfind.py:1037:8-24: TODO: __bool__ attribute base undefined for type: TypeForm[Any] (trying to access __bool__) [internal-error]
- ERROR beartype/_util/hint/pep/proposal/pep484585/generic/pep484585genget.py:863:44-57: TODO: Expr::attr_infer_for_type attribute base undefined for type: TypeForm[Any] (trying to access __call__) [internal-error]
+ ERROR beartype/_util/hint/pep/proposal/pep484585/generic/pep484585genget.py:863:44-57: Object of class `object` has no attribute `__call__` [missing-attribute]
- ERROR beartype/_util/hint/pep/proposal/pep586.py:203:12-25: TODO: Expr::attr_infer_for_type attribute base undefined for type: TypeForm[Any] (trying to access __args__) [internal-error]
+ ERROR beartype/_util/hint/pep/proposal/pep586.py:203:12-25: Object of class `object` has no attribute `__args__` [missing-attribute]
- ERROR beartype/_util/hint/pep/proposal/pep593.py:190:12-29: TODO: Expr::attr_infer_for_type attribute base undefined for type: TypeForm[Any] (trying to access __metadata__) [internal-error]
- ERROR beartype/_util/hint/pep/proposal/pep593.py:247:12-27: TODO: Expr::attr_infer_for_type attribute base undefined for type: TypeForm[Any] (trying to access __origin__) [internal-error]
+ ERROR beartype/_util/hint/pep/proposal/pep593.py:190:12-29: Object of class `object` has no attribute `__metadata__` [missing-attribute]
+ ERROR beartype/_util/hint/pep/proposal/pep593.py:247:12-27: Object of class `object` has no attribute `__origin__` [missing-attribute]
- ERROR beartype/_util/hint/pep/proposal/pep646/pep484585646tuple.py:144:9-40: TODO: Expr::binop_infer attribute base undefined for type: TypeForm[Any] (trying to access __eq__) [internal-error]
- ERROR beartype/_util/hint/pep/proposal/pep646/pep484585646tuple.py:145:9-40: TODO: Expr::binop_infer attribute base undefined for type: TypeForm[Any] (trying to access __eq__) [internal-error]
- ERROR beartype/_util/hint/pep/proposal/pep646/pep646692unpack.py:195:9-23: TODO: Expr::attr_infer_for_type attribute base undefined for type: TypeForm[Any] (trying to access __class__) [internal-error]
- ERROR beartype/_util/hint/pep/utilpepsign.py:418:17-31: TODO: Expr::attr_infer_for_type attribute base undefined for type: TypeForm[Any] (trying to access __class__) [internal-error]
- ERROR beartype/door/_cls/doormeta.py:138:21-25: Argument `TypeForm[Any]` is not assignable to parameter `key` with type `Hashable` in function `beartype._cache.cls.cacheclsmega.CacheMegaStrongCaller.cache_func_return_passed_arg` [bad-argument-type] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
accessing any attribute on a
TypeForm[T]crashed pyrefly with an internal error since it had no attribute base defined. the fix falls back to object's attribute base and now resolves normally or gives an ordinary "no attribute" error instead of crashingFixes #4747
Test Plan
python3 test.py